package at.fhooe.engine.physics.forces;

public class DirectionForce extends Force {
	
	private double m_xDir;
	private double m_yDir;
	private double m_acceleration;
	
	public DirectionForce(double xDir, double yDir, double acceleration) {
		m_xDir = xDir;
		m_yDir = yDir;
		m_acceleration = acceleration;
		normalizeDirections();
	}
	
	private void normalizeDirections() {
		double length = Math.sqrt(m_xDir * m_xDir + m_yDir * m_yDir);
		m_xDir /= length;
		m_yDir /= length;
	}
	

	@Override
	public double getAccelerationX(double time, double position, double velocity, double angularPosition) {
		return m_acceleration * m_xDir;
	}

	@Override
	public double getAccelerationY(double time, double position, double velocity, double angularPosition) {
		return m_acceleration * m_yDir;
	}
	
	@Override
	public double getAngularAcceleration(double time, double position, double velocity, double angularPosition) {
		return 0;
	}
}
